<template>
	
	<!-- Main Sidebar -->
	<a-layout-sider
		collapsible
		class="sider-primary"
		breakpoint="lg"
		collapsed-width="0"
		width="250px"
		:collapsed="sidebarCollapsed"
		@collapse="$emit('toggleSidebar', ! sidebarCollapsed)"
		:trigger="null"
		:class="['ant-layout-sider-' + sidebarColor, 'ant-layout-sider-' + sidebarTheme]"
		theme="light"
		:style="{ backgroundColor: 'transparent',}">
			<div class="brand"><img src="images/logo-ct-black.png" alt="">
        <span>No Cheat</span></div>
			<hr>

			<!-- Sidebar Navigation Menu -->
			<a-menu theme="light" mode="inline">
				<a-menu-item>
					<router-link to="/info">
						<span class="icon">
							<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
								<path d="M3 4C3 3.44772 3.44772 3 4 3H16C16.5523 3 17 3.44772 17 4V6C17 6.55228 16.5523 7 16 7H4C3.44772 7 3 6.55228 3 6V4Z" fill="#111827"/>
								<path d="M3 10C3 9.44771 3.44772 9 4 9H10C10.5523 9 11 9.44771 11 10V16C11 16.5523 10.5523 17 10 17H4C3.44772 17 3 16.5523 3 16V10Z" fill="#111827"/>
								<path d="M14 9C13.4477 9 13 9.44771 13 10V16C13 16.5523 13.4477 17 14 17H16C16.5523 17 17 16.5523 17 16V10C17 9.44771 16.5523 9 16 9H14Z" fill="#111827"/>
							</svg>
						</span>
						<span class="label">信息版</span>
					</router-link>
				</a-menu-item>

				<a-menu-item>
					<router-link to="/infoList">
						<span class="icon">
							<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
								<path d="M4 4C2.89543 4 2 4.89543 2 6V7H18V6C18 4.89543 17.1046 4 16 4H4Z" fill="#111827"/>
								<path fill-rule="evenodd" clip-rule="evenodd" d="M18 9H2V14C2 15.1046 2.89543 16 4 16H16C17.1046 16 18 15.1046 18 14V9ZM4 13C4 12.4477 4.44772 12 5 12H6C6.55228 12 7 12.4477 7 13C7 13.5523 6.55228 14 6 14H5C4.44772 14 4 13.5523 4 13ZM9 12C8.44772 12 8 12.4477 8 13C8 13.5523 8.44772 14 9 14H10C10.5523 14 11 13.5523 11 13C11 12.4477 10.5523 12 10 12H9Z" fill="#111827"/>
							</svg>
						</span>
						<span class="label">案例信息</span>
					</router-link>
				</a-menu-item>


				<a-menu-item v-if="!this.isReview">
					<router-link to="/reviewApply">
						<span class="icon">
					  <svg t="1646899612762"  viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1343" width="20" height="20"><path d="M832 224l-57.6 0L774.4 160 638.4 160l0 64L375.1744 224 375.1744 160l-136 0 0 64L192 224c-35.3472 0-64 28.6528-64 64l0 512c0 35.3472 28.6528 64 64 64l640 0c35.3344 0 64-28.6528 64-64L896 288C896 252.6528 867.3344 224 832 224zM664.8 191.4688l81.6 0 0 139.2-81.6 0L664.8 191.4688zM464.4416 467.0592c1.8368 7.008 2.6752 14.1312 2.7584 22.432 0 36.2688-24.1984 69.3312-60.7424 81.056-46.5408 14.9312-95.7888-10.4896-110.5856-56.288-10.8992-33.7472 0.8064-71.3344 28.8064-93.184 13.4208-10.4704 28.5568-16.7808 45.4656-18.5408C414.2976 397.952 453.7728 426.1376 464.4416 467.0592zM267.2 191.4688 348.8 191.4688l0 139.2L267.2 330.6688 267.2 191.4688zM526.1952 701.0048c-0.4288 8.0384-4.928 13.7088-11.6288 17.76-6.8544 4.1344-14.4704 6.0992-22.2272 7.52-18.528 3.3856-37.2736 3.5264-56.0128 3.68-18.0032 0.1344-36.0192 0.032-54.0288 0.032 0 0 0-0.0256 0-0.032-19.232 0-38.4704 0.1664-57.696-0.0704-12.2048-0.1536-24.416-0.64-36.576-1.5104-11.0208-0.7936-21.9584-2.4896-32.2432-6.9056-5.7664-2.4768-10.7776-5.952-13.888-11.6416-1.8688-3.4048-2.5024-7.0848-2.6368-10.9184-0.7296-20.6656 3.1552-40.32 13.3184-58.4768 13.2032-23.6032 32.5376-40.2112 57.7344-49.984 13.0176-5.0368 26.56-7.2512 40.4736-7.2768 21.3696-0.032 42.7392-0.0768 64.1024 0.0128 28.3456 0.128 53.44 9.216 74.7008 28.0384 18.9696 16.7808 30.7328 37.7664 35.2 62.7712C526.4 682.9504 526.6816 691.9744 526.1952 701.0048zM774.4 718.4 618.9312 718.4l0-47.8336L774.4 670.5664 774.4 718.4zM774.4 640.2432 618.9312 640.2432l0-47.8336L774.4 592.4096 774.4 640.2432zM774.4 564.9024 618.9312 564.9024l0-47.8336L774.4 517.0688 774.4 564.9024zM774.4 488.3712 618.9312 488.3712l0-47.8336L774.4 440.5376 774.4 488.3712z" p-id="1344"></path></svg>
						</span>
						<span class="label">申请成为审核员</span>
					</router-link>
				</a-menu-item>

        <a-menu-item v-if="this.isReview">
					<router-link to="/authManage">
						<span class="icon">
            <svg t="1646899744872"  viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2865" width="20" height="20"><path d="M878.592 781.312q4.096 14.336 7.168 36.352t3.072 44.544-3.584 42.496-10.752 30.208q-5.12 7.168-26.112 13.824t-52.736 12.288-70.656 10.752-77.824 8.704-75.776 5.12-64.512 1.536-64-2.048-74.752-5.12-76.288-7.168-69.12-9.216-53.248-9.728-27.136-9.728q-9.216-7.168-14.336-45.568t4.096-99.84q5.12-34.816 28.16-53.248t53.248-29.184 63.488-18.944 57.856-24.576q19.456-12.288 30.208-23.552t15.36-22.528 4.608-23.552-1.024-27.648q-2.048-22.528-14.848-34.816t-28.16-25.6q-8.192-6.144-13.824-17.92t-10.752-24.064q-5.12-13.312-9.216-29.696-2.048-2.048-6.144-7.168-3.072-5.12-7.168-13.824t-9.216-25.088-6.656-29.184 0.512-22.016q1.024-11.264 5.12-19.456 0-35.84 4.096-71.68 4.096-29.696 13.312-64.512t29.696-62.464q18.432-25.6 39.936-42.496t44.544-26.112 46.592-12.8 45.056-3.584q23.552 2.048 38.4 5.632t24.064 8.704 15.872 12.288 13.824 14.336l19.456 0q9.216 0 17.92 2.56t17.408 9.728 18.944 20.48q23.552 30.72 34.816 67.072t16.384 69.12q5.12 37.888 6.144 74.752 2.048 5.12 3.072 12.288t1.536 17.408-1.536 25.6q-2.048 20.48-6.144 32.256t-9.216 17.92q-5.12 7.168-11.264 10.24-4.096 16.384-9.216 29.696-5.12 12.288-10.752 24.064t-13.824 17.92q-17.408 14.336-28.672 24.064t-15.36 33.28q-3.072 14.336-2.048 28.672t7.68 29.184 21.504 28.16 41.472 23.552q23.552 9.216 51.712 16.896t54.272 17.408 46.592 25.088 28.672 39.936zM549.888 747.52q3.072-6.144 0.512-12.8t-7.68-12.8-12.288-13.312l-47.104 0q-7.168 7.168-11.264 13.312-4.096 5.12-6.656 11.264t0.512 11.264q7.168 14.336 12.288 25.088t11.264 16.896q-2.048 9.216-6.144 26.112t-7.68 34.816-6.144 33.792-2.56 24.064q0 5.12 4.608 12.288t10.752 14.848 12.8 12.8 11.776 5.12 12.288-5.12 13.824-11.776 11.264-14.336 4.608-12.8q0-6.144-3.072-20.992t-6.656-33.28-7.68-35.84-7.168-27.648q6.144-5.12 11.776-14.848t13.824-26.112z" p-id="2866"></path></svg>						</span>
						<span class="label">管理后台</span>
					</router-link>
				</a-menu-item>

        <a-menu-item>
          <router-link to="/test">
						<span class="icon">
              <svg t="1646899917727" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8635" width="20" height="20"><path d="M725.333333 106.666667a170.666667 170.666667 0 0 1 170.666667 170.666666v469.333334a170.666667 170.666667 0 0 1-170.666667 170.666666H298.666667a170.666667 170.666667 0 0 1-170.666667-170.666666V277.333333a170.666667 170.666667 0 0 1 170.666667-170.666666h426.666666z m-29.333333 445.973333H328.064l-3.349333 0.170667c-23.893333 2.496-35.072 31.658667-17.365334 49.002666l117.696 115.114667 2.773334 2.389333c11.52 8.768 28.16 7.936 38.698666-2.453333l2.432-2.709333a28.373333 28.373333 0 0 0-2.496-37.973334l-67.413333-65.984h296.96l3.413333-0.192A28.992 28.992 0 0 0 725.333333 581.418667c0-15.893333-13.141333-28.8-29.333333-28.8z m-99.797333-247.957333a29.738667 29.738667 0 0 0-38.72 2.453333l-2.432 2.709333a28.373333 28.373333 0 0 0 2.496 37.973334l67.413333 65.984h-296.96l-3.413333 0.192A28.992 28.992 0 0 0 298.666667 442.581333c0 15.893333 13.141333 28.8 29.333333 28.8h367.936l3.349333-0.192c23.893333-2.496 35.072-31.658667 17.365334-49.002666l-117.696-115.114667z" fill="#333333" p-id="8636"></path></svg>
            </span>
              <span class="label">在线交易（预留）</span>
          </router-link>
        </a-menu-item>


				<a-menu-item class="menu-item-header">
					账户信息
				</a-menu-item>
				<a-menu-item>
					<router-link to="/profile">
						<span class="icon">
							<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
								<path fill-rule="evenodd" clip-rule="evenodd" d="M18 10C18 14.4183 14.4183 18 10 18C5.58172 18 2 14.4183 2 10C2 5.58172 5.58172 2 10 2C14.4183 2 18 5.58172 18 10ZM12 7C12 8.10457 11.1046 9 10 9C8.89543 9 8 8.10457 8 7C8 5.89543 8.89543 5 10 5C11.1046 5 12 5.89543 12 7ZM9.99993 11C7.98239 11 6.24394 12.195 5.45374 13.9157C6.55403 15.192 8.18265 16 9.99998 16C11.8173 16 13.4459 15.1921 14.5462 13.9158C13.756 12.195 12.0175 11 9.99993 11Z" fill="#111827"/>
							</svg>
						</span>
						<span class="label">个人主页</span>
					</router-link>
				</a-menu-item>

			</a-menu>
			<!-- / Sidebar Navigation Menu -->

			<!-- Sidebar Footer -->
			<div class="aside-footer">
				<div class="footer-box">
					<span class="icon">
<!--					 <a-icon type="question-circle" theme="filled" />-->
<!--            <a-icon type="question" theme="outlined" />-->
            <svg t="1646550022827"  viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3203" ><path d="M450.267 772.245l0 92.511 92.511 0 0-92.511L450.267 772.245zM689.448 452.28c13.538-24.367 20.311-50.991 20.311-79.875 0-49.938-19.261-92.516-57.765-127.713-38.517-35.197-90.114-52.8-154.797-52.8-61.077 0-110.191 16.4-147.342 49.188-37.16 32.798-59.497 80.032-67.014 141.703l83.486 9.927c7.218-46.025 22.41-79.875 45.576-101.533 23.166-21.665 52.047-32.494 86.647-32.494 35.802 0 66.038 11.957 90.711 35.874 24.667 23.92 37.01 51.675 37.01 83.266 0 17.451-4.222 33.55-12.642 48.284-8.425 14.747-26.698 34.526-54.83 59.346s-47.607 43.701-58.442 56.637c-14.741 17.754-25.424 35.354-32.037 52.797-9.028 23.172-13.537 50.701-13.537 82.584 0 5.418 0.146 13.539 0.45 24.374l78.069 0c0.599-32.495 2.855-55.966 6.772-70.4 3.903-14.44 9.926-27.229 18.047-38.363 8.127-11.123 25.425-28.43 51.901-51.895C649.43 506.288 675.908 476.656 689.448 452.28L689.448 452.28z" p-id="3204"></path></svg>
					</span>
					<h6>需要帮助？</h6>
					<p>点击按钮进行反馈</p>
					<a-button type="primary" href="" block target="_blank">
						意见反馈
					</a-button>
				</div>
			</div>
			<!-- / Sidebar Footer -->

<!--			<a-button type="primary" href="https://www.creative-tim.com/product/muse-vue-ant-design-dashboard-pro" block target="_blank">-->
<!--				UPGRADE TO PRO-->
<!--			</a-button>-->

	</a-layout-sider>
	<!-- / Main Sidebar -->

</template>

<script>

	export default ({
		props: {
			// Sidebar collapsed status.
			sidebarCollapsed: {
				type: Boolean,
				default: false,
			},
			
			// Main sidebar color.
			sidebarColor: {
				type: String,
				default: "primary",
			},
			
			// Main sidebar theme : light, white, dark.
			sidebarTheme: {
				type: String,
				default: "light",
			},
		},
		data() {
			return {
				// sidebarCollapsedModel: this.sidebarCollapsed,
        isReview: false,

			}
		},
    mounted() {
      this.getUserInfo();
    },
    methods:{
      getUserInfo(){
        this.$axios({
          headers: {
            "Content-Type": "application/json;charset=UTF-8",
            "Authorization": sessionStorage.getItem("systemToken")
          },
          url: "/api/user/getUserInfoByUserId", //后端请求的路径
          method: "post",
          params: {
            userId: sessionStorage.getItem("userId"),
          },
        }).then((response) => {
          console.log(response.data)
          if (response.data.data.user.role == "Admin" || response.data.data.user.role == "Review"){
            this.isReview = true
          }else {
            this.isReview = false
          }
        });
      }
    }
  })

</script>
